<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.EditMaterialTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"  globalOnly="true"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="3">
                    <h:outputLabel value="#{bundle.MaterialLabel_id}" for="id" />
                    <h:inputText id="id" value="#{materialController.selected.id}" readonly="true" 
                    />
                    <h:message for="id" styleClass="error"/>
                    <h:outputLabel value="#{bundle.MaterialLabel_descricao}*" for="descricao" />
                    <h:inputText id="descricao" value="#{materialController.selected.descricao}" 
                                 title="#{bundle.MaterialTitle_descricao}" 
                                 required="true" 
                                 requiredMessage="#{bundle.descricaoMaterialRequired}"
                                 validator="#{materialController.validaMaterial}"
                    />
                    <h:message for="descricao" styleClass="error"/>
                    <h:outputLabel value="#{bundle.MaterialLabel_tempoDecomposicao}*" for="tempoDecomposicao" />
                    <h:inputText id="tempoDecomposicao" 
                                 value="#{materialController.selected.tempoDecomposicao}" 
                                 title="#{bundle.MaterialTitle_tempoDecomposicao}" 
                                 required="true" 
                                 requiredMessage="#{bundle.tempoDecomposicaoMaterialRequired}"
                                 validator="#{materialController.validaMaterial}"
                    />
                    <h:message for="tempoDecomposicao" styleClass="error"/>
                    <h:outputLabel value="#{bundle.MaterialLabel_toxico}" for="toxico" />
                    <h:selectBooleanCheckbox id="toxico" value="#{materialController.selected.toxico}" title="#{bundle.MaterialTitle_toxico}" />
                    <h:message for="toxico" styleClass="error"/>
                    <h:outputLabel value="#{bundle.MaterialLabel_tipo}" for="tipo" />
                    <h:selectOneMenu id="tipo" value="#{materialController.selected.tipo}"
                                     required="true" 
                                     requiredMessage="#{bundle.tipoMaterialRequired}">
                        <f:selectItems value="#{materialController.listaTipoMaterial}"
                                       />  
                    </h:selectOneMenu>                        
                    <h:message for="tipo" styleClass="error"/>
                    <h:outputLabel value="#{bundle.MaterialLabel_observacoes}" for="observacoes" />
                    <h:inputTextarea rows="4" cols="30" id="observacoes" value="#{materialController.selected.observacoes}" title="#{bundle.MaterialTitle_observacoes}" />
                    <h:message for="observacoes" styleClass="error"/>
                </h:panelGrid>
                <h:commandLink action="#{materialController.update}" value="#{bundle.SaveLink}"/>
            </h:form>
        </ui:define>
    </ui:composition>
</html>

